SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE dbo.[DnnProduct_GetSearchItems]

	@PortalID int,
	@TabId int,
	@ModuleId int

AS
	SELECT DISTINCT
        SearchItemID, 
        ModuleID, 
        Title, 
        [Description], 
        Author, 
        PubDate, 
        SearchKey, 
        [Guid], 
        HitCount, 
        ImageFileId, 
        AuthorName
	FROM   dbo.DnnProduct_vw_SearchItems
	WHERE (PortalId = @PortalID or @PortalID is null)
		AND   (TabId = @TabId or @TabId is null)
		AND   (ModuleId = @ModuleId or @ModuleId is null)
	ORDER BY PubDate DESC
GO
